﻿using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Windows.Controls;
using ParaEditor.Infrastructure;
using Micropayment.Model;
using Microsoft.Practices.Prism.Commands;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.ServiceLocation;

namespace ParaEditor.Desktop.View
{
    /// <summary>
    /// MainWindowView.xaml 的交互逻辑
    /// </summary>
    [Export(ViewNames.MainWindowViewName,typeof(UserControl))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public partial class MainWindowView : UserControl
    {
        public DelegateCommand<string> ChangeViewCommand { get; private set; }
        public ObservableCollection<MODULE> ModuleCollection { get; private set; }

        [ImportingConstructor]
        public MainWindowView(IRegionManager regionManager)
        {
            this.ChangeViewCommand = new DelegateCommand<string>(this.ChangeView);
            this.ModuleCollection = new ObservableCollection<MODULE>();

            InitializeComponent();
            this.MainContent.DataContext = this;
        }

        private void ChangeView(string ViewName)
        {
            this.MainContent.Content = ServiceLocator.Current.GetInstance((typeof(UserControl)), ViewName);
        }

    }
}
